home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / segal / storage.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-22  |  6.0 KB  |  243 lines

  1. /*
  2.  *    storage.c - for use with SEGAL.
  3.  *
  4.  *    By Bryan Skene
  5.  *
  6.  */
  7.  
  8. #include "common.h"
  9.  
  10. /***** Global Variables *****/
  11. BRUSH_INFO    brush;
  12. CROP_INFO    crop;
  13. FRAME_INFO    frame;
  14. GROW_INFO    grow;
  15. IMAGE_INFO    img;
  16. MASK_INFO    m[MAX_MASKS + 1];
  17. MLOG_INFO    mlog;
  18. REGION_INFO    region;
  19. RGB_INFO    rgb;
  20. SEGAL_CURSOR    my_cursor[NUM_BRUSH_SIZES][MAX_ZOOM_MAG];
  21. SEGAL_INFO    segal;
  22. THRESH_INFO    threshold;
  23. TIMER_INFO    timer;
  24. WIN_INFO    win[NUM_WINS];
  25.  
  26. /* Running things in the background */
  27. struct itimerval itimer;
  28.  
  29. /* HIPS header stuff */
  30. int ac;
  31. char **av;
  32.  
  33. /* command line args */
  34. char     *in_image, *in_mask, *in_list;
  35. int      overlay_hue;
  36.  
  37. /* colors */
  38. int    num_rgb;    /* number of colors in rgb_histo */
  39.  
  40. /* 3d buffers */
  41. u_char   ***cbuf[NUM_CPLANES]; /* space for a 3d color image */
  42. u_char   ***ibuf;        /* space for a 3d image */
  43. u_char   ***mbuf;        /* space for 7 bit-masks and a 3d region */
  44.  
  45. /* 1d buffers */
  46. u_char   *bm;           /* bit masks ... */
  47. byte     bm_key[NUM_OF_BITS];     /* bit mask keys */
  48.  
  49. /***** X Windows *****/
  50. /* window stuff shared by all parts - DEFINED in segal.c */
  51. Display *display;
  52. u_long *colors;
  53. GC gc;
  54. int screen;
  55. Xv_cmsdata cms_data;
  56. Visual   *winv;
  57. XVisualInfo *winv_info;
  58. Window    mainw;
  59.  
  60. u_char *image_map;
  61. int im_size;
  62.  
  63. /* from cmap.c */
  64. u_char gray_lut[256];    /* just image */
  65. u_char blend_lut[256];    /* mask-image blend */
  66. u_char pt_lut[256];    /* point list */
  67.  
  68. /* cursor used everywhere */
  69. Cursor watch_cursor;
  70.  
  71. /* preferences */
  72. int    verbose;
  73.  
  74. /***********************************************************/
  75. void
  76. info_init()
  77. {
  78.         int i, j;
  79.  
  80.         segal.x = UNDEFINED;
  81.         segal.y = UNDEFINED;
  82.         segal.z = UNDEFINED;
  83.     segal.r1 = UNDEFINED;
  84.     segal.c1 = UNDEFINED;
  85.     segal.f1 = UNDEFINED;
  86.     segal.r2 = UNDEFINED;
  87.     segal.c2 = UNDEFINED;
  88.     segal.f2 = UNDEFINED;
  89.         segal.r = UNDEFINED;
  90.         segal.c = UNDEFINED;
  91.         segal.f = UNDEFINED;
  92.     segal.color = TRUE;
  93.         segal.r3d = FALSE;
  94.         segal.roi = R3d_WHOLE;
  95.         segal.disp_image = TRUE;
  96.         segal.disp_mask = TRUE;
  97.         segal.disp_pts = TRUE;
  98.         segal.disp_xy = TRUE;
  99.         segal.mode = MODE_SEGMENT;
  100.     segal.bg_i = UNDEFINED;
  101.         segal.num_m = 0;
  102.         segal.e_m = UNDEFINED;
  103.     segal.new_m = UNDEFINED;
  104.  
  105.         mlog.sel_m = UNDEFINED;
  106.         mlog.apply_log = TRUE;
  107.         mlog.apply_order = ORDER_EI;
  108.  
  109.     timer.semaphore = UNLOCKED;
  110.     timer.width = UNDEFINED;
  111.     timer.height = UNDEFINED;
  112.     strcpy(timer.message, "No message");
  113.     timer.qfront = 0;
  114.     timer.qrear = 0;
  115.  
  116.         img.loaded = FALSE;
  117.     img.r = UNDEFINED;
  118.     img.c = UNDEFINED;
  119.     img.f = UNDEFINED;
  120.     img.frame_size = UNDEFINED;
  121.         img.dname[0] = NULL;
  122.         img.fname[0] = NULL;
  123.         img.fp = NULL;
  124.         img.color = FALSE;
  125.         img.changed_image = FALSE;
  126.         img.changed_frame = FALSE;
  127.     For_all_aspects for(j = 0; j < NUM_CPLANES; j++) {
  128.         img.undo[i][j] = NULL;
  129.         img.orig[i][j] = NULL;
  130.     }
  131.  
  132.         For_all_masks {
  133.                 m[i].loaded = FALSE;
  134.         m[i].f = UNDEFINED;
  135.                 m[i].dname[0] = NULL;
  136.                 m[i].fname[0] = NULL;
  137.                 m[i].changed_mask = FALSE;
  138.                 m[i].changed_frame = FALSE;
  139.                 m[i].mask_type = MASK_NO_APPLY;
  140.                 m[i].mask_hue = MASK_GREEN;
  141.                 m[i].bit_key = (int) pow(2.0, (double) i);
  142.         }
  143.  
  144.         For_all_windows {
  145.                 win[i].zoom_mag = UNDEFINED;
  146.  
  147.                 if(i <= ASPECT_Z) win[i].aspect = i;
  148.                 else win[i].aspect = ASPECT_Z;
  149.  
  150.                 win[i].f = UNDEFINED;
  151.                 win[i].img_r = UNDEFINED;
  152.                 win[i].img_c = UNDEFINED;
  153.                 win[i].img_size = UNDEFINED;
  154.                 win[i].canv_x = UNDEFINED;
  155.                 win[i].canv_y = UNDEFINED;
  156.                 win[i].canv_w = UNDEFINED;
  157.                 win[i].canv_h = UNDEFINED;
  158.                 win[i].repaint = TRUE;
  159.                 win[i].xid = UNDEFINED;
  160.                 win[i].ximg = NULL;
  161.         }
  162.  
  163.     crop.win_id = UNDEFINED;
  164.     crop.x1 = UNDEFINED;
  165.     crop.y1 = UNDEFINED;
  166.     crop.f1 = UNDEFINED;
  167.     crop.x2 = UNDEFINED;
  168.     crop.y2 = UNDEFINED;
  169.     crop.f2 = UNDEFINED;
  170.     For_all_aspects for(j = 0; j < NUM_VIEW_HANDLES; j++) {
  171.         crop.handle[i][j].x = UNDEFINED;
  172.         crop.handle[i][j].y = UNDEFINED;
  173.     }
  174.  
  175.     rgb.quant.quality = Q_BEST;
  176.     rgb.quant.win = WIN_VZ;
  177.     rgb.quant.num_from_histo = 100; /* determined by quality */
  178.     rgb.quant.auto_r = UNDEFINED;
  179.     rgb.quant.auto_g = UNDEFINED;
  180.     rgb.quant.auto_b = UNDEFINED;
  181.     rgb.quant.max_samples = UNDEFINED;
  182.     rgb.quant.min_rgb_dist = UNDEFINED;
  183.     rgb.num_histo = 0;
  184.     rgb.histo = NULL;
  185.     rgb.map_r = 32;            /* determined by quality */
  186.     rgb.map_g = 24;
  187.     rgb.map_b = 16;
  188.     rgb.map = NULL;
  189.  
  190.         region.x1 = UNDEFINED;
  191.         region.y1 = UNDEFINED;
  192.         region.f1 = UNDEFINED;
  193.         region.x2 = UNDEFINED;
  194.         region.y2 = UNDEFINED;
  195.         region.f2 = UNDEFINED;
  196.         region.beg_frame = UNDEFINED;
  197.         region.end_frame = UNDEFINED;
  198.  
  199.     threshold.min = 0;
  200.     threshold.max = 255;
  201.     threshold.roi = R2d_WHOLE;
  202.     threshold.plane = VAL_RGB;
  203.     threshold.mask_effect = THRESH_OVERWRITE;
  204.     threshold.image_effect = -20;
  205.     threshold.degree = 20;
  206.     threshold.xid = UNDEFINED;
  207.  
  208.         frame.offset = 0;
  209.         frame.current = UNDEFINED;
  210.         frame.upper = UNDEFINED;
  211.         frame.lower = UNDEFINED;
  212.  
  213.         brush.mode = BRUSH_MASK;
  214.         brush.image_affect = -20;
  215.     brush.degree = 20;
  216.         brush.mask_affect = MASK_PAINT;
  217.         brush.shape = BRUSH_SQUARE;
  218.         brush.size = 1;
  219.  
  220.         grow.swin = WIN_PAINT;
  221.         grow.direction = DIR_GROW;
  222.         grow.apply_thresholds = TRUE;
  223.         grow.threshold_min = 0;
  224.         grow.threshold_max = 255;
  225.         grow.apply_gradient = TRUE;
  226.         grow.gradient_rad = 1;
  227.         grow.gradient_min = 0;
  228.         grow.gradient_max = 100;
  229.         grow.apply_bridge = TRUE;
  230.     grow.bridge_dist = 5;
  231.         grow.bridge_min = 1;
  232.         grow.bridge_max = 8;
  233.         grow.extent = GROW_FRAME;
  234.         grow.seed_pt_src = SEED_EDIT;
  235.         grow.overwrite = TRUE;
  236.         grow.disp_growth = DISP_ALL;
  237.     grow.interractive = TRUE;
  238.         grow.speed = 2000;
  239.         grow.stack_empty = TRUE;
  240.  
  241.         For_all_bits bm_key[i] = (int) pow(2.0, (double) i);
  242. }
  243.